<?php
/**
 * CompleXml Framework
 *
 * @category   CompleXml
 * @package    CompleXml_Validate
 * @copyright  Copyright (c) 2008 Andrey Kucherenko
 * @license    New BSD License
 * @version    $Id: Ip.php 8 2008-11-13 14:50:42Z kucherenko.andrey $
 */

/**
 * @see CompleXml/Validate/Abstract.php
 */
require_once 'CompleXml/Validate/Abstract.php';
class CompleXml_Validate_Ip extends CompleXml_Validate_Abstract
{
    public function isValid ($value)
    {
        $valueString = (string) $value;

        if (ip2long($valueString) === false) {
            $this->setError('Ip not valid');
            return false;
        }
        return true;
    }
}